#include<vector>
#include<list>

namespace xyx
{
    template<class T,class Con = vector<T>>
    class stack
    {
    public:
        void push(const T& x)
        {
            con.push_back(x);
        }
        void pop()
        {
            con.pop_back();
        }
        T& top()
        {
            return con.back();
        }
        size_t size()
        {
            return con.size();
        }
        bool empty()
        {
            return con.empty();
        }
    private:
        Con con;
    };
    
    void test_stack()
    {
        stack<int> s1;
        stack<int,list<int>> s2;
        
        s1.push(1);
        s1.push(2);
        s1.push(3);
        s1.push(4);
        
        s2.push(1);
        s2.push(2);
        s2.push(3);
        s2.push(4);
        
        while(!s1.empty())
        {
            cout << s1.top() <<" ";
            s1.pop();
        }
        cout << endl;
        
        while(!s2.empty())
        {
            cout << s2.top() <<" ";
            s2.pop();
        }
        cout << endl;
    }

}
